/**
 * @param {Object} config 
 * @param {"success" | "loading" | "error" | "none" | "fail" | "exception"} config.icon - 图标
 * @param {string} config.title - 文字
 * @param {boolean} config.mast - 禁止点击背景
 * @param {number} config.duration - 显示持续时间，默认1500
 */
export function showToast(config) {
	uni.hideToast();

	const {
		icon,
		title,
		mask,
		duration
	} = config;

	uni.showToast({
		icon,
		title,
		mask,
		duration
	});
}

export function showErrorToast(title = "错误") {
	showToast({
		icon: "error",
		title,
		mask: true,
		duration: 1000
	})
}

export function showSuccessToast() {
	showToast({
		icon: "success",
		title: "成功",
		mask: true,
		duration: 1000
	});
}